import instance from "@/http/index.js";
// 用户详情
export const getUserInfor = id =>{
	return instance({
		url:"/user/getUserInfo",
		method:"POST",
		data:{
			id
		}
	})
}
// 绑定账号
export const bindAccount = (account,onlyId,url) =>{
	return instance({
		url:"/user/bindAccount",
		method:"POST",
		data:{
			account,
			onlyId,
			url
		}
	})
}
// 修改姓名
export const changeName = (name,id) =>{
	return instance({
		url:"/user/changeName",
		method:"POST",
		data:{
			name,
			id
		}
	})
}
// 修改性别
export const changeSex = (sex,id) =>{
	return instance({
		url:"/user/changeSex",
		method:"POST",
		data:{
			sex,
			id
		}
	})
}
// 修改邮箱
export const changeEmail = (email,id) =>{
	return instance({
		url:"/user/changeEmail",
		method:"POST",
		data:{
			email,
			id
		}
	})
}
// 修改密码
export const changePassword = (id,oldPassword,newPassword) =>{
	return instance({
		url:"/user/changePassword",
		method:"POST",
		data:{
			id,
			oldPassword,
			newPassword
		}
	})
}
// ---------------------- 用户管理
// 添加管理员
export const createAdmin = data =>{
	return instance({
		url:"/user/createAdmin",
		method:"POST",
		data:{
			...data
		}
	})
}
// 获取管理员列表
export const getAdminList = (identity,page,size) =>{
	return instance({
		url:"/user/getAdminList",
		method:"POST",
		data:{
			identity,
			page,
			size
		}
	})
}
// 编辑管路员信息
export const editAdmin = data =>{
	return instance({
		url:"/user/editAdmin",
		method:"POST",
		data:{
			...data
		}
	})
}
// 对管理员进行降职的操作
export const changeIdentityToUser = id =>{
	return instance({
		url:"/user/changeIdentityToUser",
		method:"POST",
		data:{
			id
		}
	})
}
// 对用户进行赋权的操作
export const changeIdentityToAdmin = id =>{
	return instance({
		url:"/user/changeIdentityToAdmin",
		method:"POST",
		data:{
			id
		}
	})
}
// 通过账号对用户进行搜索
export const searchUser = account =>{
	return instance({
		url:"/user/searchUser",
		method:"POST",
		data:{
			account
		}
	})
}
// 冻结用户
export const banUser = id =>{
	return instance({
		url:"/user/banUser",
		method:"POST",
		data:{
			id
		}
	})
}
// 解冻用户
export const hotUser = id =>{
	return instance({
		url:"/user/hotUser",
		method:"POST",
		data:{
			id
		}
	})
}
// 获取冻结列表
export const getBanList = () =>{
	return instance({
		url:"/user/getBanList",
		method:"POST",
		data:{
		}
	})
}
// 删除用户
export const deleteUser = (id,account) =>{
	return instance({
		url:"/user/deleteUser",
		method:"POST",
		data:{
			id,
			account
		}
	})
}